cmake_minimum_required( VERSION 2.8 )
project("konkordo")

add_subdirectory( plugins/logons/stdlogon stdlogon )

find_package( Qt4 REQUIRED )
include( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    ../qxmlrpc
    interfaces
)

set(INSTPREF ${CMAKE_INSTALL_PREFIX})
configure_file(def.h.in def.h)


set( HEADERS
    diastart.h
    diasettings.h
)

set( CPPS
    main.cpp
    diastart.cpp
    diasettings.cpp
)
set( UIS
    diastart.ui
    diasettings.ui
)

qt4_wrap_ui(UIS_H ${UIS})

qt4_wrap_cpp( MOC_SOURCES ${HEADERS} )

set( RESOURCES res.qrc )
qt4_add_resources( QRC_SOURCES ${RESOURCES} )

if(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
    add_executable( konkordo WIN32 ${CPPS} ${MOC_SOURCES} ${UIS_H} ${QRC_SOURCES})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
    add_executable( konkordo ${CPPS} ${MOC_SOURCES} ${UIS_H} ${QRC_SOURCES})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
    add_executable( konkordo ${CPPS} ${MOC_SOURCES} ${UIS_H} ${QRC_SOURCES})
endif()



target_link_libraries( konkordo ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES} qxmlrpc)

# install for linux
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
    set(rootdir ${CMAKE_INSTALL_PREFIX})
    set(rootdir_bin ${rootdir}/bin)
    install(TARGETS konkordo DESTINATION ${rootdir_bin})
endif()
# install for mac os x
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
    set(rootdir ${CMAKE_INSTALL_PREFIX})
    set(rootdir_bin ${rootdir}/bin)
    install(TARGETS konkordo DESTINATION ${rootdir_bin})
endif()
